package org.tequino.rcpipa.server;
import java.sql.*;
import org.tequino.rcpipa.client.*;
import org.tequino.rcpipa.shared.FieldVerifier;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public  class GreetingServiceImpl extends RemoteServiceServlet implements
		Myservice {

	public String greetServer(String fase,int iteracion,String id,int version,String fecha,String funcionalidad) throws IllegalArgumentException {
		// Verify that the input is valid. 
		if (!FieldVerifier.isValidName(fase)) {
			// If the input is not valid, throw an IllegalArgumentException back to
			// the client.
			throw new IllegalArgumentException(
					"Name must be at least 4 characters long");
		}

		String serverInfo = getServletContext().getServerInfo();
		String userAgent = getThreadLocalRequest().getHeader("User-Agent");
	
		
		conexion con = new conexion();
		requisito r = new requisito(fase,iteracion,id,version,fecha,funcionalidad);
		//r.llenar(fase, iteracion, id, version, fecha, funcionalidad);
		con.agregar(r);
		return "Hello, " + fase + "!<br><br>I am running " + serverInfo
				+ ".<br><br>It looks like you are using:<br>" + userAgent;
	}
	

	
}
